package rs.frenjoynet.core.ui;

import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Install;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.ScopeType;
import org.jboss.seam.log.Log;

import java.util.Map;
import java.util.HashMap;

/**
 * Created by IntelliJ IDEA.
 * User: ppopovic
 * Date: 05.11.2009.
 * Time: 15.36.25
 * To change this template use File | Settings | File Templates.
 */
@Name ("navigationBean")
@Scope (ScopeType.EVENT)
@Install (true)
public class NavigationBean
{
	private String pageClickForView;
	private String mainSearchKey;
	@Logger
	private Log log;

	private static Map<String, String> navigationMaps;

	static
	{
		navigationMaps = new HashMap<String, String>();
		navigationMaps.put("home", "/home.jsf");
		navigationMaps.put("profile", "/profile.jsf");
		navigationMaps.put("account", "/account.jsf");
	}

	private static Map<String, String> moduleMaps;

	static
	{
		moduleMaps = new HashMap<String, String>();
		moduleMaps.put("/home.jsf", "home");
		moduleMaps.put("/account.jsf", "home");

	}
	public String getPageClickForView()
	{
		return pageClickForView;
	}

	public void setPageClickForView(String pageClickForView)
	{
		this.pageClickForView = pageClickForView;
	}

	public String jump()
	{
		String pageJump = navigationMaps.get(pageClickForView);
		log.debug("!!!!!!!!-----!!!!!!"+moduleMaps.get(pageJump)+"/"+pageJump);
		return moduleMaps.get(pageJump)+pageJump;
	}

	public String getMainSearchKey()
	{
		return mainSearchKey;
	}

	public void setMainSearchKey(String mainSearchKey)
	{
		this.mainSearchKey = mainSearchKey;
	}
}
